package com.meeruu.sg.account.core.api.constant;

import lombok.Getter;

/**
 * @author yangqintao
 * @date 2019-05-16
 */
@Getter
public enum AccountStatus {

    NORMAL(0, "正常"),
    FROZEN(1, "冻结"),
    BLACK(2, "拉黑"),

    ;
    private Integer code;
    private String desc;

    AccountStatus(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static AccountStatus getStatusByCode(Integer code){

        for(AccountStatus status:values()){
            if (status.code.equals(code)){
                return status;
            }
        }

        throw new IllegalArgumentException("不支持的状态类型" + code);
    }
}
